﻿using System;
using System.ComponentModel;

namespace Com.PhilChuang.Pmvp.Ui.Views
{
	public interface IView : IDisposable
	{
		#region Events
		/// <summary>
		/// Fires when the view is loaded
		/// </summary>
		event Action Loaded;
		/// <summary>
		/// Fires every time the view is shown
		/// </summary>
		event Action Shown;
		/// <summary>
		/// Fires when the user initiates the close
		/// </summary>
		event EventHandler<CancelEventArgs> DoClose;
		/// <summary>
		/// Fires when the view is closed / hidden
		/// </summary>
		event Action Closed;
		/// <summary>
		/// Fires when the view is being disposed
		/// </summary>
		event Action Unloaded;
		#endregion

		#region Functionality
		void EnableAllControls (bool enabled);

		void Close ();

		void Show ();
		#endregion

		#region Utility methods
		void DisplayErrorMessage (String text, String caption);

		void DisplayMessage (String text, String caption);

		/// <summary>
		/// Displays a yes/no dialog to the user
		/// </summary>
		/// <param name="text"></param>
		/// <param name="caption"></param>
		/// <returns>user selected yes</returns>
		bool DisplayYesNoChoice (string text, string caption);
		#endregion
	}
}
